<template>
    <div>
        <Modal width="1200"
               v-model="modal.openMsgFlag"
               footer-hide
               :mask-closable=false
               :styles="{top: '10px'}"
               title="消息">
            <br/>
            <Form :label-width="40">
                <FormItem label="标题">
                    <div class="mydiv6">{{modal.objectMsg.title}}</div>
                </FormItem>
                <FormItem style="margin-bottom: 0px" label="内容">
                    <div class="mydiv7" v-html="modal.objectMsg.content"></div>
                </FormItem>
            </Form>
            <br/>
        </Modal>
    </div>
</template>

<script>
    export default {
        name: "openMsg",
        props: {
            modal: {
                openMsgFlag: false,
                objectMsg: {}
            }
        },
        data() {
            return {
                loading: false,
            }
        },
        methods: {}, watch: {
            'modal.openMsgFlag'(val) {
                if (val) {
                    let data = {
                        "userId": this.$store.state.user.user.userId,
                        "announcementId": this.modal.objectMsg.announcementId
                    }
                    this.http.tput("/msg/updateRead", this.qs.stringify(data)).then(res => {
                        if (res.data) {
                            this.MySocket.commit("updateAnnouncement", this.modal.objectMsg.announcementId)
                        }
                    })
                }
            }
        }
    }
</script>

<style scoped>
    .mydiv6 {
        background-color: #e2e2e2;
        padding-left: 10px;
        border-radius: 5px
    }

    .mydiv7 {
        border: 1px #d7d7d7 solid;
        padding-left: 5px;
        border-radius: 5px;
        max-height: 800px;
        overflow-y: auto;
        overflow-x: hidden;
    }
</style>
